/**
 * 
 */
package dms.dto;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

import com.sun.crypto.provider.DESCipher;

import dms.util.Constant;

/**
 * @author 李健
 *
 */
public class SchoolDTO extends ActionForm {

	private Long id;
	private String name;
	private String description;
	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
		
		if (name == null || name.length() == 0) {
			errors.add("errors", new ActionMessage("缺少学院名称", false));
		}
		if (description == null || description.length() == 0) {
			errors.add("errors", new ActionMessage("缺少学院介绍", false));
		}
		
		return errors;
	}
	
	@Override
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		this.name = null;
		this.description = null;
	}
}
